Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix StrictMode issue #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix StrictMode issue #5

wants to merge 1 commit into from

Conversation

djhi
Copy link

@djhi djhi commented Sep 12, 2023

Problem

When React StrictMode is enabled, the demo useEffect is executed twice, leading to an infinite reload loop.

Solution

Ensure we only initialize once

@djhi djhi added the RFR Ready For Review label Sep 12, 2023
@@ -47,6 +47,7 @@ const getPermissions = (decoded: KeycloakTokenParsed) => {

const App = () => {
const [keycloak, setKeycloak] = useState<Keycloak>(undefined);
const initializingPromise = useRef<Promise<Keycloak>>(undefined);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants